package com.cin.cma.client;

import cn.hutool.cron.CronUtil;
import com.cin.cma.client.config.WorkerBase;
import com.cin.cma.client.job.PushCinemaWorker;
import com.cin.cma.client.job.PushScheduleWorker;
import com.cin.cma.client.job.PushSeatWorker;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;


@SpringBootApplication
@ComponentScan(basePackages = "com.cin.cma.*")
@MapperScan("com.cin.cma.client.repository.*")
public class ClientApplication {
    public static void main(String[] args) {
        try {
            SpringApplication springApplication = new SpringApplication(ClientApplication.class);
            springApplication.setBannerMode(Banner.Mode.OFF);
            ApplicationContext context = springApplication.run(args);
            CronUtil.setMatchSecond(true);
            CronUtil.start();
            //每1小时整点推送一次影院信息
            //WorkerBase pushCinemaWorker = context.getBean(PushCinemaWorker.class);
            //pushCinemaWorker.execute("0 0 0/1 * * ? ");
            ////每2、4、6、12点执行一次推送座位图
            //WorkerBase pushSeatWorker = context.getBean(PushSeatWorker.class);
            //pushSeatWorker.execute("0 0 2,4,6,12 * * ? ");
            ////每5分钟点执行一次推送排期
            //WorkerBase pushScheduleWorker = context.getBean(PushScheduleWorker.class);
            //pushScheduleWorker.execute("0 0/5 * * * ? ");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
}
